import * as Utils from 'utils.js';
/**
 * 速云档案api
 */

//提示框
export function showTip(msg) {
	uni.showToast({
		position: 'bottom',
		title: msg,
		duration: 1000,
		style: "z-index:9999",
	});
};
//确认框
export function showConfirm(msg, sureClick) {
	uni.showModal({
		title: '提示',
		content: msg,
		success: function(res) {
			if (res.confirm) {
				sureClick(true);
			} else if (res.cancel) {
				sureClick(false);
			}
		}
	});
}
/**
 * @param {Object}商品分类
 */
export function GoodsTypeList(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_GoodsTypeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除多条码
 */
export function Delete_GoodsBarCodeMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_GoodsBarCodeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除多单位
 */
export function Delete_GoodsUnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_GoodsUnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增商品分类
 */
export function AddGoodsType(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_GoodsTypeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}更新仓库档案
 */
export function Update_StoreMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_StoreMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}删除商品分类
 */
export function DeleteGoodsType(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_GoodsTypeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除商品分类
 */
export function Delete_ClientMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_ClientMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}修改商品分类
 */
export function UpdateGoodsType(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_GoodsTypeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除会员档案
 */
export function Delete_MemberMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_MemberMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增商品多单位
 */
export function Add_GoodsUnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_GoodsUnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}查询销售订单
 */
export function GetSaleOrder(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_Sale_Report");
	console.log(url);
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}查询商品单位
 */
export function Get_GoodsUnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_UnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}查询商品多条码
 */
export function Get_GoodsBarcodeMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_GoodsBarcodeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}查询期初库存
 */
export function Get_GoodsEarlyMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_GoodsEarlyMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增商品多条码
 */
export function Add_GoodsBarCodeMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_GoodsBarCodeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}更新商品多条码
 */
export function Update_GoodsBarCodeMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_GoodsBarCodeMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增商品单位
 */
export function Add_UnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_UnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}



/**
 * @param {Object}修改商品单位
 */
export function Update_UnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_UnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除商品单位
 */
export function Delete_UnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_UnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}查詢部門檔案 Department
 * 
 * */
export function Get_DepartmentMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_DepartmentMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}新增部門檔案 Department
 * 
 * */
export function Add_DepartmentMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_DepartmentMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}修改部門檔案 Department
 * 
 * */
export function Update_DepartmentMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_DepartmentMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除部門檔案 Department
 * 
 * */
export function Delete_DepartmentMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_DepartmentMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}查询仓库档案 Department
 * 
 * */
export function Get_StoreMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_StoreMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增仓库档案 Department
 * 
 * */
export function Add_StoreMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_StoreMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}查询商品档案 
 * 
 * */
export function Get_GoodsMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_GoodsMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}新增商品档案
 * Department
 * 
 * */
export function Add_GoodsMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_GoodsMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}删除商品档案
 */
export  function DeleteGoodsMessage(arr,callBack){
	let url = Utils.getPostIp("/api/DeleteGoodsMessage");
	let data =  Utils.getData(arr);
	var responseArr =  {};
	Utils.httpGetClient(url,data,"POST",function(data,state){
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}更新商品档案表

 */
export  function Update_Add_GoodsMessage(arr,callBack){
	let url = Utils.getPostIp("/api/Update_Add_GoodsMessage");
	let data =  Utils.getData(arr);
	var responseArr =  {};
	Utils.httpGetClient(url,data,"POST",function(data,state){
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}查询员工档案
 * 
 * */
export function Get_OperatorMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_OperatorMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增员工档案
 * 
 * */
export function AddOperatorMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_OperatorMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}更新员工档案
 * 
 * */
export function Update_OperatorMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_OperatorMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}删除员工档案
 * 
 * */
export function DeleteOperatorMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_OperatorMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}查询往来单位
 * 
 * */
export function Get_ClientMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_ClientMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}查询会员档案
 * 
 * */
export function Get_MemberMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_MemberMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}查询银行卡号
 * 
 * */
export function Get_BankMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_BankMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}删除银行档案
 * 
 * */
export function Delete_BankMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_BankMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增银行账号
 * 
 * */
export function AddBankMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_BankMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}修改银行账号
 * 
 * */
export function Update_BankMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_BankMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}查询机构档案
 * 
 * */
export function Get_BranchMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Get_BranchMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "GET", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}新增期初库存
 * 
 * */
export function Add_GoodsEarlyMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_GoodsEarlyMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}删除机构档案
 * 
 * */
export function Delete_BranchMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Delete_BranchMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}


/**
 * @param {Object}更新机构档案
 * 
 * */
export function Update_BranchMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_BranchMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}
/**
 * @param {Object}新增机构档案
 * 
 * */
export function Add_BranchMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_BranchMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}



/**
 * @param {Object}新增往来单位档案
 * 
 * */
export function Add_ClientMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_ClientMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}更新往来单位档案
 * 
 * */
export function Update_ClientMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_ClientMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}新增会员信息
 * 
 * */
export function Add_MemberMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Add_MemberMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}新增会员信息
 * 
 * */
export function Update_GoodsUnitMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_GoodsUnitMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

/**
 * @param {Object}更新会员信息
 * 
 * */
export function Update_MemberMessage(arr, callBack) {
	let url = Utils.getPostIp("/api/Update_MemberMessage");
	let data = Utils.getData(arr);
	var responseArr = {};
	Utils.httpGetClient(url, data, "POST", function(data, state) {
		console.log(data);
		responseArr.data = data.data;
		responseArr.state = state;
		callBack(responseArr);
	});
}

//保留两位小数
export function setTwoFloat(num) {
	return Math.round(num * 100) / 100;
}
